import sqlobject
from coptur.database import *

from coptur.models.task import Task
from coptur.models.task import Port

class Host(sqlobject.SQLObject):

    _connection = connection.connect

    #name = sqlobject.StringCol(length=14, unique=True)
    #lastCall = sqlobject.DateTimeCol(default=None)
    name = sqlobject.StringCol(length=255)
    ip = sqlobject.StringCol(length=255)
    scan_info=sqlobject.StringCol()
    task = sqlobject.ForeignKey('Task')
    ports = sqlobject.MultipleJoin('Port', joinColumn='port_id')
# create table if not exists
Host.createTable(ifNotExists=True)
